#! /bin/sh
#### Run GBmod with Xwindow Graphics
#### Create Figure 8 in the GBmod paper

# model number
model=3

####  find the right directory
datadir=../datadir/

####  aux files
modelfile=${datadir}model${model}.data
rayendsfile=${datadir}rayend.data
rayfile=${datadir}ray.data

nangle=20 nxz=201 nt=20 fangle=-17 langle=-8

####   generate modelpsfile
#../Models/Xmodel{model}

####   shoot the rays 
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile nangle=$nangle \
        nxz=$nxz  xs=1 zs=0.1 krecord=1 \
        fangle=$fangle langle=$langle \
        refseq=1,-1 \
	refseq=3,0,1,0 \
	refseq=4,1,1 

####   plot the rays 
xgraph linecolor=3 <$rayfile -geom 600x300+670+330 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=1 x2beg=0 x2end=2  style=seismic linecolor=3 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths" &

####   shoot the rays 
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile nangle=$nangle \
        nxz=$nxz  xs=1 zs=0.1 krecord=1  \
        fangle=7 langle=15 \
        refseq=1,-1 \
	refseq=2,0,1,0 \
	refseq=3,1,0,0 \
        refseq=4,1 

####   plot the rays
xgraph linecolor=3 <$rayfile -geom 600x300+670+660 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=1 x2beg=0 x2end=2  style=seismic linecolor=3 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths" &

#### Create X-Windows display of model
sxplot <$modelfile -geom 600x300+670+0 tricolor=none \
        label1="Depth (km)" label2="Distance (km)" &

exit 0

